Trying to split a string which represents a baseline
string baselines = "112.1 a"
int Majperiodlocation = 0
int Sufspacelocation = 0
int offset = null
int periodlength
int spacelength
int stringlength = length(baselines)
//find period
if(findPlainText (baselines, "2", offset, periodlength, false)){
Majperiodlocation = periodlength
}
if(findPlainText (baselines, " ", offset, spacelength, false)){
Sufspacelocation = spacelength
}
print baselines[0:Majperiodlocation] "\n" // prints "Major"
print baselines[Majperiodlocation:Sufspacelocation]"\n" // prints "minor"
print baselines[Sufspacelocation:] "\n" // prints "suffix"
liamc - Mon Mar 08 08:44:17 EST 2010 |
Re: Splitting a string - Splitting a baseline into its components
apologies, silly error...
string baselines = "112.1 a"
int Majperiodlocation = 0
int Sufspacelocation = 0
int offsetperiod = null
int offsetspace = null
int periodlength = null
int spacelength = null
int slength = length(baselines)
//find period
if(findPlainText (baselines, ".", offsetperiod, periodlength, false)){
Majperiodlocation = offsetperiod
}
if(findPlainText (baselines, " ", offsetspace, spacelength, false)){
Sufspacelocation = offsetspace
}
//print offsetperiod
//print offsetspace
print baselines[0:(offsetperiod-1)] "\n" // prints "Major"
print baselines[(offsetperiod):offsetspace] "\n" // prints "minor"
print baselines[offsetspace:] "\n" // prints "suffix"
|
Re: Splitting a string - Splitting a baseline into its components liamc - Mon Mar 08 08:59:14 EST 2010
apologies, silly error...
string baselines = "112.1 a"
int Majperiodlocation = 0
int Sufspacelocation = 0
int offsetperiod = null
int offsetspace = null
int periodlength = null
int spacelength = null
int slength = length(baselines)
//find period
if(findPlainText (baselines, ".", offsetperiod, periodlength, false)){
Majperiodlocation = offsetperiod
}
if(findPlainText (baselines, " ", offsetspace, spacelength, false)){
Sufspacelocation = offsetspace
}
//print offsetperiod
//print offsetspace
print baselines[0:(offsetperiod-1)] "\n" // prints "Major"
print baselines[(offsetperiod):offsetspace] "\n" // prints "minor"
print baselines[offsetspace:] "\n" // prints "suffix"
Why are you parsing baseline strings? I ask because there may be easier ways to do whatever conversion you need done. |
Re: Splitting a string - Splitting a baseline into its components liamc - Mon Mar 08 08:59:14 EST 2010
apologies, silly error...
string baselines = "112.1 a"
int Majperiodlocation = 0
int Sufspacelocation = 0
int offsetperiod = null
int offsetspace = null
int periodlength = null
int spacelength = null
int slength = length(baselines)
//find period
if(findPlainText (baselines, ".", offsetperiod, periodlength, false)){
Majperiodlocation = offsetperiod
}
if(findPlainText (baselines, " ", offsetspace, spacelength, false)){
Sufspacelocation = offsetspace
}
//print offsetperiod
//print offsetspace
print baselines[0:(offsetperiod-1)] "\n" // prints "Major"
print baselines[(offsetperiod):offsetspace] "\n" // prints "minor"
print baselines[offsetspace:] "\n" // prints "suffix"
int major(Baseline b) int minor(Baseline b) string suffix(Baseline b) string annotation(Baseline b) string user(Baseline b) Date dateOf(Baseline b) |